<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript">
			var str = 12345678,tmp
			var
			function re(_this){
				    for(var x=_this.length-1;x>0;x--){
				        str+=_this.charAt(x);
				    } 
				    return str;
				    
			}
			var restr = re(str)
			console.log(restr)
			for(var i = 1 ; i<=re(str).length;i++){
				tmp +=re(str)[i-1];
				console.log(tmp)
				if(i%3==0 && i!=re(str).length){
					tmp +=','
				}
			}
			console.log(tmp)
		</script>
	</head>
	<body>
	</body>
</html>
